﻿<%@page import="com.yunzhong.appointment.config.SessionConst"%>
<%@page import="com.yunzhong.appointment.entity.SysMenu"%>


<%@page import="org.apache.shiro.subject.Subject"%>
<%@page import="org.apache.shiro.SecurityUtils"%>
<%@ page import="com.alibaba.druid.sql.visitor.functions.Substring" %>
<%@ page import="org.apache.catalina.Realm" %>
<%@ page import="com.yunzhong.appointment.config.Const" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<%@include file="../common/common.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="../../static/css/bootstrap.min.css"/>
		<script type="text/javascript" src="../../static/js/jquery-2.2.4.min.js"></script>
		<script type="text/javascript" src="../../static/js/jquery.tips.js"></script>
		<script type="text/javascript" src="../../static/js/bootstrap.min.js" ></script>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>云众科技网上预约挂号系统</title>
	</head>
	<style type="text/css">
		html body{
			width: 100%;
		}
		.kuang{
			border:1px solid gainsboro;
			/*圆角*/
			border-radius: 10px ;
			margin: 0px;
		}
		.info_left{
			border: 1px solid gainsboro;
			/*圆角*/
			border-radius: 10px ;
		}
	</style>
	<body>
		<!--
        	作者：石洪刚
        	时间：2017年8月10日14:12:50
        	描述：个人中心	联系我们	登录	注册
        -->
		<div class="container">
			<nav class="nav navbar-default navbar-fixed-top container-fluid" role="navigation" style="background-color:aquamarine;">
				<div class="nav navbar-header">
					<!-- 导航头 -->
					<a class="navbar-brand" href="#">云众科技</a>
					<button class="navbar-toggle" data-toggle= "collapse" data-target="#mynav">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
				</div>
				<div class="collapse navbar-collapse" id="mynav">
					<!-- 导航内容 -->
					<ul class="nav navbar-nav">
						<li><a href="">联系电话：0451-87362836</a></li>
						<!-- 下面的代码需要登录后才能显示 -->
						<shiro:authenticated>
							<%
								Subject currentUser = SecurityUtils.getSubject();
								String userName = (String)currentUser.getSession().getAttribute(SessionConst.SESSION_USERNAME);
								SysMenu personalMenu = (SysMenu)currentUser.getSession().getAttribute(SessionConst.SESSION_PERSONAL_MENU);
							%>
						<li><a href="javascript:showMenu('<%=personalMenu.getMenuId()%>')">个人中心</a></li>
						<li><a href="#"><span class="glyphicon glyphicon-user"></span>欢迎您：<%=userName %></a></li>
						</shiro:authenticated>
					</ul>



					<input type="hidden" id="id" name="patientId" value="${pat.patientId}">
					<input type="hidden" id="name" name="patientName" value="${pat.patientName}">
					<input type="hidden" id="tel" name="patientTel" value="${tel}">
					<input type="hidden" id="uid" name="patientUid" value="${ide}">
					<input type="hidden" id="sex" name="patientSex" value="${pat.patientSex}">
					<input type="hidden" id="birth" name="patientBirth" value="<fmt:formatDate value="${pat.patientBirth}" pattern="yyyy-MM-dd"></fmt:formatDate>">
					<input type="hidden" id="pro" name="provinceId" value="${pat.provinceId}">
					<input type="hidden" id="cit" name="cityId" value="${pat.cityId}">
					<input type="hidden" id="are" name="areaId" value="${pat.areaId}">


					<!-- 导航尾，登录后不再显示 -->
					<shiro:notAuthenticated>
						<div class="nav navbar-right">
							<ul class="nav navbar-nav">
								<li><a href="/login">登录</a></li>
								<li><a href="/register/pageRegister">注册</a></li>
							</ul>
						</div>
					</shiro:notAuthenticated>
				</div>
			</nav>
		</div>
		<!--
        	作者：石洪刚
        	时间：2017年8月10日14:32:38
        	描述：项目名称   搜索框 （搜索框只有游客或患者可见）
        -->
		<div class="container" style="margin-top: 50px;">
			<div class="col-sm-6" >
				<h2 class="text-primary" >云众科技网上预约挂号系统</h2>
			</div>
			<shiro:hasRole name="guest">
				<div class="col-sm-6" style="margin-top: 15px;">
					<form method="post" name="form1" class="form form-horizontal">
						<div class="input-group">
							<div class="input-group-btn">
								<button id="index_search_btn" type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown">${sessionScope.illnessName!=null && sessionScope.illnessName!=""?"疾病":"科室" }<span class="caret"></span></button>
								<ul class="dropdown-menu" role="menu">
									<li><a href="javascript:searchType('科室')">科室</a></li>
									<li><a href="javascript:searchType('疾病')">疾病</a></li>
								</ul>
							</div><!-- /btn-group -->
							<input type="text" class="form-control" placeholder="请输入搜索内容" value="${sessionScope.deptName}${sessionScope.illnessName}">
							<span class="input-group-addon" style="background-color:#f0ad4e;cursor: pointer;" onclick="searchDoc(this)" >
						      	<span class="glyphicon glyphicon-search "></span>
					      	</span>
						</div>
					</form>
				</div>
			</shiro:hasRole>
			<shiro:hasRole name="patient">
				<div class="col-sm-6" style="margin-top: 15px;">
					<form method="post" name="form1" class="form form-horizontal">
						<div class="input-group">
							<div class="input-group-btn">
								<button id="index_search_btn" type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown">${sessionScope.illnessName!=null && sessionScope.illnessName!=""?"疾病":"科室" }<span class="caret"></span></button>
								<ul class="dropdown-menu" role="menu">
									<li><a href="javascript:searchType('科室')">科室</a></li>
									<li><a href="javascript:searchType('疾病')">疾病</a></li>
								</ul>
							</div><!-- /btn-group -->
							<input type="text" class="form-control" placeholder="请输入搜索内容" value="${sessionScope.deptName}${sessionScope.illnessName}">
							<span class="input-group-addon" style="background-color:#f0ad4e;cursor: pointer;" onclick="searchDoc(this)" >
						      	<span class="glyphicon glyphicon-search "></span>
					      	</span>
						</div>
					</form>
				</div>
			</shiro:hasRole>

		</div>
		<!--
        	作者：石洪刚
        	时间：2017年8月10日17:04:47
        	描述：导航条   游客可见(在dashboard页) ：按科室挂号  按疾病挂号  最新公告
        -->
		<div class="container" style="margin-top: 10px;">
			<ul class="nav nav-pills guahao" role="tablist" style="background-color:lightcyan">
			  	<li ><a href="/">首页</a></li>
<%--			  	<li ><a href="../appointment/dept/listDept.html">按科室预约</a></li>--%>
<%--				<li ><a href="../appointment/illness/listIllness.html">按疾病预约</a></li>--%>
<%--				<li ><a href="/listAnnouncement/query">最新公告</a></li>--%>

				<%
					Subject currentUser = SecurityUtils.getSubject();
					List menuList = (ArrayList)currentUser.getSession().getAttribute(SessionConst.SESSION_MENULIST);
					SysMenu currentMenu = (SysMenu)currentUser.getSession().getAttribute(SessionConst.SESSION_MENU);
					if(currentMenu==null){
						currentMenu = new SysMenu();
					}
					for(int i=0;i<menuList.size();i++){
						SysMenu topMenu = (SysMenu)menuList.get(i);
				%>
				<li class="<%=topMenu.getMenuId().equals(currentMenu.getMenuId())?"active":"" %>">
					<a href="javascript:showMenu('<%=topMenu.getMenuId()%>')">
						<%=topMenu.getMenuName() %>
					</a>
				</li>
				<%
					}
				%>
			</ul>
		</div>
		<!--
        	作者：石洪刚 
        	时间：2017年8月14日21:05:08
        	描述：显示对应菜单信息
        -->
        <div class="container" >
        	<div class="col-sm-3">
        		<div class="panel">
        			<div class="col-sm-12" style="margin-top: 10px;">
        				<ul class="nav nav-tabs nav-stacked info_left">

            					<li><a href="javascript:info_change('/personal/querypersonal')">个人信息</a></li>
            					<li><a href="javascript:info_change('/personal/head')">修改头像</a></li>
							<shiro:hasRole name="patient">
            					<li ><a  href="javascript:info_change('order/listOrder.html')">订单详情</a></li>
            					<li><a href="javascript:info_change('order/listOrder.html')">未付款订单</a></li>
							</shiro:hasRole>
            					<li><a href="javascript:info_change('personal/editPassword.html')">修改密码</a></li>
            					<li><a href="javascript:info_change('/logout')">退出登录</a></li>
        				</ul>
				</div>
        		</div>
        	</div>
        	<div class="col-sm-9" >
        		<div class="panel" >
        			<div class="col-sm-12 col-xs-12 info_left" style="margin-top: 10px;">

<%--						<%--%>

<%--							if(currentUser.hasRole(Const.ROLE_PATIENT)){--%>
<%--						%>--%>
<%--						<iframe name="info_iframe" src="<%=request.getContextPath() %>/personal/listOrder?order_state=N" style="width:100%;height: 500px;border: none;" ></iframe>--%>
<%--						<%--%>
<%--						}else{--%>
<%--						%>--%>
<%--						<iframe name="info_iframe" src="<%=request.getContextPath() %>/personal/querypersonal" style="width:100%;height: 500px;border: none;" ></iframe>--%>
<%--						<%--%>
<%--							}--%>
<%--						%>--%>

        				<iframe name="info_iframe" src="<%=request.getContextPath()%>/personal/querypersonal" style="width:100%;height: 500px;border: none;" ></iframe>


        			</div>
        		</div>
        	</div>
        </div>
	</body>
	<script type="text/javascript">
		//个人信息
		function info_change(data){
			if(data=="/logout"){
				location.href = "<%=request.getContextPath()%>/logout";
			}
			$('iframe').attr('src',data);
		}
		
	</script>
</html>